/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tubosmonterrey.cotizador.tb;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author rsoberanis
 */
@Entity
@Table(name = "tbcotizacion_tmp")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TbcotizacionTmp.findAll", query = "SELECT t FROM TbcotizacionTmp t"),
    @NamedQuery(name = "TbcotizacionTmp.findById", query = "SELECT t FROM TbcotizacionTmp t WHERE t.id = :id"),
    @NamedQuery(name = "TbcotizacionTmp.findByTotal", query = "SELECT t FROM TbcotizacionTmp t WHERE t.total = :total"),
    @NamedQuery(name = "TbcotizacionTmp.findByIdproducto", query = "SELECT t FROM TbcotizacionTmp t WHERE t.idproducto = :idproducto")})
public class TbcotizacionTmp implements Serializable {
    @JoinColumn(name = "usuario", referencedColumnName = "id")
    @ManyToOne
    private Tbusuarios usuario;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private String id;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "total")
    private Double total;
    @Column(name = "idproducto")
    private String idproducto;
    @JoinColumn(name = "cliente", referencedColumnName = "id")
    @ManyToOne
    private Tbclientes cliente;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tbcotizacionTmp")
    private Collection<TbcotizacionTmpPos> tbcotizacionTmpPosCollection;

    public TbcotizacionTmp() {
    }

    public TbcotizacionTmp(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Double getTotal() {
        return total;
    }

    public void setTotal(Double total) {
        this.total = total;
    }

    public String getIdproducto() {
        return idproducto;
    }

    public void setIdproducto(String idproducto) {
        this.idproducto = idproducto;
    }

    public Tbclientes getCliente() {
        return cliente;
    }

    public void setCliente(Tbclientes cliente) {
        this.cliente = cliente;
    }

    @XmlTransient
    public Collection<TbcotizacionTmpPos> getTbcotizacionTmpPosCollection() {
        return tbcotizacionTmpPosCollection;
    }

    public void setTbcotizacionTmpPosCollection(Collection<TbcotizacionTmpPos> tbcotizacionTmpPosCollection) {
        this.tbcotizacionTmpPosCollection = tbcotizacionTmpPosCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TbcotizacionTmp)) {
            return false;
        }
        TbcotizacionTmp other = (TbcotizacionTmp) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.tubosmonterrey.cotizador.tb.TbcotizacionTmp[ id=" + id + " ]";
    }

    public Tbusuarios getUsuario() {
        return usuario;
    }

    public void setUsuario(Tbusuarios usuario) {
        this.usuario = usuario;
    }
    
}
